/*
 * ImgsManager.java
 * business
 *
 * Created by SunDing on 2016/10/12.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.manager;

import com.yidiandao.business.ui.widget.listview.displaylistitem.ChooseLocalPictureGridItem;

import java.util.ArrayList;
import java.util.List;

/**
 * 管理发布求购信息的图片
 */
public class ImageManager {

    private static ImageManager manager = new ImageManager();

    private List<String> mCurrentList = new ArrayList<>();

    private List<String> mFinalList = new ArrayList<>();

    private List<String> mImageIdList = new ArrayList<>();

    private ChooseLocalPictureGridItem.OnItemClickClass mChooseLocalPictureGridItem;

    private OnSureClickListener mOnSureClickListener;

    private ImageManager() {
    }

    public static ImageManager getInstance() {
        return manager;
    }

    public List<String> getImageId() {
        return mImageIdList;
    }

    public void setImageId(String imageId) {
        mImageIdList.add(imageId);
    }

    public List<String> getFinalImageList() {
        return mFinalList;
    }

    public void setFinalImageList(List<String> list) {
        mFinalList.clear();
        mFinalList.addAll(list);
    }

    public List<String> getCurrentImageList() {
        return mCurrentList;
    }

    public void setCurrentImageList(List<String> list) {
        mCurrentList.clear();
        mCurrentList.addAll(list);
    }

    /**
     * 清空数据
     */
    public void clearList() {
        mCurrentList.clear();
        mFinalList.clear();
        mImageIdList.clear();
    }

    /**
     * GirdView 的item点击事件
     */
    public ChooseLocalPictureGridItem.OnItemClickClass getClickListener() {
        return mChooseLocalPictureGridItem;
    }

    /**
     * GirdView 的item点击事件
     */
    public void setClickListener(
            ChooseLocalPictureGridItem.OnItemClickClass chooseLocalPictureGridItem) {
        mChooseLocalPictureGridItem = chooseLocalPictureGridItem;
    }

    /**
     * 选择图片的确定按钮的点击事件
     */
    public void setOnSureListener(OnSureClickListener onSureClickListener) {
        mOnSureClickListener = onSureClickListener;
    }

    public void onSureImage(List<String> list) {
        if (mOnSureClickListener != null) {
            mOnSureClickListener.onSuccess(list);
        }
    }

    public interface OnSureClickListener {
        void onSuccess(List<String> list);
    }
}
